<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>会员信息</title>
    <link type="text/css" rel="stylesheet" href="${request.contextPath}/statics/stu/fontsawesome/css/font-awesome.css" />
    <link type="text/css" rel="stylesheet" href="${request.contextPath}/statics/stu/css/style.css" />
</head>

<body>
    <div class="main_box">


        <div class="cont_box">
            <ul class="tab_tit clearfix" id="lis">

            </ul>
            <dl class="tab_conbox">
                <!--会员基本信息-->
                <dd>
                    <form action="#" method="post" id="edit_user">
                        <div class="addpro_box clearfix">
                            <label>姓名：</label>
                            <input id = "username" type="text"  name="username" readonly  data-rule-fullname="true" />
                        </div>
                        <div class="addpro_box clearfix">
                            <label>学号：</label>
                            <input id = "sno" type="text" readonly name="sno"  data-rule-mobile="true"  />
                        </div>
                        <div class="addpro_box clearfix">
                            <label>手机号：</label>
                            <input id = "phone" type="text"  name="phone" required data-rule-mobile="true"  />
                        </div>
                        <div class="addpro_box clearfix">
                            <label>所属班级：</label>
                            <input  id = "clazz"  type="text" name="clazz"  readonly/>
                        </div>
                        <div class="addpro_box clearfix">
                            <label>导员：</label>
                            <input id = "guname" type="text" name="guname"  readonly/>
                        </div>
                        <div class="addpro_box clearfix">
                            <label>班主任：</label>
                            <input  id = "headname"  type="text" name="headname"  readonly/>
                        </div>
                        <div class="addpro_box clearfix">
                            <label>总得分：</label>
                            <input  id = "score"  type="text" name="score"  readonly/>
                        </div>
                        <div class="probtn_box clearfix">
                            <input type="button" value="保存修改" class="btn blue_btn submit">
                        </div>
                    </form>
                </dd>
                <!--行政得分-->
                <dd>
                    <div class="margin_tb clearfix">

                    </div>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <thead>
                        <tr>
                            <th>得分项</th>
                            <th>分值</th>
                            <th>得分时间</th>

                        </tr>
                        </thead>
                        <tbody id = "xingzheng">

                        </tbody>
                    </table>
                </dd>
                <dd>
                    <!--当前储值卡为空时显示添加按钮-->

                    <div class="margin_tb clearfix">

                    </div>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <thead>
                        <tr>
                            <th>得分项</th>
                            <th>分值</th>
                            <th>得分时间</th>

                        </tr>
                        </thead >
                        <tbody id = "xuexi">

                        </tbody>
                    </table>
                </dd>
                <!--年卡-->
                <dd>
                    <div class="margin_tb clearfix">

                    </div>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <thead>
                        <tr>
                            <th>得分项</th>
                            <th>分值</th>
                            <th>得分时间</th>

                        </tr>
                        </thead>
                        <tbody id="qinshi">

                        </tbody>
                    </table>
                </dd>
                <!--大礼包-->
                <dd>
                    <div class="margin_tb clearfix">

                    </div>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <thead>
                        <tr>
                            <th>得分项</th>
                            <th>分值</th>
                            <th>得分时间</th>

                        </tr>
                        </thead>
                        <tbody id="xingzhengs">

                        </tbody>
                    </table>
                </dd>
                <!--消费记录-->
                <dd>
                    <div class="margin_tb clearfix">

                    </div>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <thead>
                        <tr>
                            <th>得分项</th>
                            <th>分值</th>
                            <th>得分时间</th>

                        </tr>
                        </thead>
                        <tbody id="xuexis">

                        </tbody>
                    </table>
                </dd>
                <!--积分记录-->
                <dd>
                    <div class="margin_tb clearfix">

                    </div>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <thead>
                        <tr>
                            <th>得分项</th>
                            <th>分值</th>
                            <th>得分时间</th>

                        </tr>
                        </thead>
                        <tbody id="qinshis" >

                        </tbody>
                    </table>
                </dd>
            </dl>
        </div>
    </div>
    <!--javascript include-->
    <script src="${request.contextPath}/statics/stu/js/jquery-2.2.1.min.js"></script>
    <script src="${request.contextPath}/statics/stu/js/jquery.dataTables.min.js"></script>
    <script src="${request.contextPath}/statics/stu/js/bootstrap-datepicker.js"></script>
    <script src="${request.contextPath}/statics/stu/js/jquery.validate.min.js"></script>
    <script src="${request.contextPath}/statics/stu/js/other.js"></script>

    <script>

        var baseUrl= baseUrl();
        function baseUrl()
        {
            //获取当前网址，如： http://localhost:8080/myproj/view/my.jsp
            var curWwwPath=window.document.location.href;
            //获取主机地址之后的目录，如： myprojiew/my.jsp
            var pathName=window.document.location.pathname;
            var pos=curWwwPath.indexOf(pathName);
            //获取主机地址，如： http://localhost:8080
            var localhostPaht=curWwwPath.substring(0,pos);
            //获取带"/"的项目名，如：/myproj
            var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
            //得到了 http://localhost:8080/myproj
            var realPath=localhostPaht+projectName;
            return realPath;
            //alert(realPath);
        }
        $(function() {

            jqtab(".tab_tit", ".tab_conbox", "click");


        });




        function jqtab(tabtit, tab_conbox, events) {
            liList();
            $(tabtit).find("li:first").addClass("curr").show();
            $(tab_conbox).find("dd").hide();
            $(tab_conbox).find("dd:first").show();

            $(tabtit).find("li").bind(events, function() {
                $(this).addClass("curr").siblings("li").removeClass("curr");
                var activeindex = $(tabtit).find("li").index(this);
                $(tab_conbox).children().eq(activeindex).show().siblings().hide();
                var va =  $(this).find("input").val();
                var id = $(this).find("input").attr("id")

                scoreList(id,va);

                return false;
            });

            info();

            // scoreList(2,"xuexi");
            // scoreList(3,"qinshi");
            // scoreList(4,"xingzhengs");
            // scoreList(5,"xuexis");
            // scoreList(6,"qinshis");
        };
        function info(){
            $.ajax({
                type: 'post',

                url: baseUrl + '/stu/info',
                success: function(data) {
                    $("#username").val(data.sname);
                    $("#clazz").val(data.clazz);
                    $("#guname").val(data.guname);
                    $("#headname").val(data.headname);
                    $("#phone").val(data.phone);
                    $("#sno").val(data.sno);
                    $("#score").val(data.score);

                }
            });
        }


        function scoreList(a,t) {
            $.ajax({
                type: 'post',
                url: baseUrl + '/eval/record',
                data: {"pid": a},
                dataType: "json",
                async:false,
                success: function (data) {

                    $("#" + t).empty(); //清空表格
                    var trs = "";
                    $.each(data, function (i, v) {
                        trs = trs + "<tr><td>" + v.name + "</td><td>" + v.score + "</td> <td>" + v.time + "</td></tr>";
                    })

                    $("#" + t).append(trs);

                }
            });

        }
            function liList(){
                $.ajax({
                    type: 'post',
                    url: baseUrl + '/eval/type',
                    dataType:"json",
                    async:false,
                    success: function(data) {
                        console.log(data)
                        $("#lis").empty(); //清空表格
                        var ls = "<li >基本信息<input type='hidden' /></li>";
                        $.each(data,function (i,v) {
                            ls = ls+"<li>"+v.name+"<input type='hidden' id='"+v.id+"' value='"+v.type+"' /></li>" ;
                        })

                        $("#lis").append(ls);

                    }
                });
        }
    </script>
</body>

</html>